function init() {
   checkLogin();
}

function checkLogin() {
   var ajax = new Ajax.Request(
      "../bin/sessionCheck.php",
      {
         onSuccess: checkLoginOver
      }
   );

   return true;
}

function checkLoginOver(req) {
   var content = req.responseText;

   if(parseInt(content) != -1) {
      $("mloginDiv").innerHTML = "登陆成功" + content;
      $("controlBarDiv").className = "";
   }
}

function verifyMLogin() {
   var form = $("mloginForm");
   var postData = form.serialize();
   var ajax = new Ajax.Request(
      "../bin/mLogin.php",
      {
         method: "post",
         postBody: postData,
         onSuccess: loginOverHandler
      }
   );
}

function loginOverHandler(req) {
   var content = req.responseText;

   if(parseInt(content) != -1) {
      $("mloginDiv").innerHTML = "登陆成功" + content;
      $("controlBarDiv").className = "";
      return true;
   }
   else {
      alert("name and pass wrong!");
      return false;
   }
}